package com.example.springbooteasycode;

import com.example.springbooteasycode.bootsocket.SocketServer;
import jakarta.annotation.Resource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.CommandLineRunner;

@SpringBootApplication
public class SpringbootEasycodeApplication implements CommandLineRunner{

    public static void main(String[] args) {
        SpringApplication.run(SpringbootEasycodeApplication.class, args);
    }

    @Resource
    private SocketServer socketServer;

    // Spring 启动完成后执行
    @Override
    public void run(String... args) throws Exception {
        socketServer.start(); // 启动 Socket 服务端
    }

}
